home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / NetHack 3.1.3 / source / sys / share / lev_lex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-01  |  49.2 KB  |  1,630 lines  |  [TEXT/R*ch]

  1. /* A lexical scanner for NetHack generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  * flexhack.skel 3.1.3 (from .../flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36)
  5.  */
  6. #define FLEXHACK_SCANNER
  7.  
  8. /* amount of stuff to slurp up with each read */
  9. #ifndef YY_READ_BUF_SIZE
  10. #define YY_READ_BUF_SIZE 8192
  11. #endif
  12.  
  13. /* returned upon end-of-file */
  14. #define YY_END_TOK 0
  15.  
  16. /* copy whatever the last rule matched to the standard output */
  17. #define ECHO (void)fwrite((genericptr_t)yytext, yyleng, 1, yyout)
  18.  
  19. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  20.  * is returned in "result".
  21.  */
  22. #define YY_INPUT(buf,result,max_size) \
  23.     if ((result = fread((genericptr_t)buf, 1, max_size, yyin)) <= 0 && \
  24.         !feof(yyin))  YY_FATAL_ERROR( "fread(yyin) in flex scanner failed" );
  25. #define YY_NULL 0
  26.  
  27. /* no semi-colon after return; correct usage is to write "yyterminate();" */
  28. #define yyterminate() return ( YY_NULL )
  29.  
  30. /* report a fatal error */
  31. #define YY_FATAL_ERROR(msg) \
  32.     do { \
  33.         (void) fputs( msg, stderr ); \
  34.         (void) putc( '\n', stderr ); \
  35.         exit( 1 ); \
  36.     } while ( 0 )
  37.  
  38. /* default yywrap function - always treat EOF as an EOF */
  39. #define yywrap() 1
  40.  
  41. /* enter a start condition.  This macro really ought to take a parameter,
  42.  * but we do it the disgusting crufty way forced on us by the ()-less
  43.  * definition of BEGIN
  44.  */
  45. #define BEGIN yy_start = 1 + 2 *
  46.  
  47. /* action number for EOF rule of a given start state */
  48. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  49.  
  50. /* special action meaning "start processing a new file" */
  51. #define YY_NEW_FILE \
  52.     do { \
  53.         yy_init_buffer( yy_current_buffer, yyin ); \
  54.         yy_load_buffer_state(); \
  55.     } while ( 0 )
  56.  
  57. /* default declaration of generated scanner - a define so the user can
  58.  * easily add parameters
  59.  */
  60. #define YY_DECL int NDECL(yylex)
  61.  
  62. /* code executed at the end of each rule */
  63. #define YY_BREAK break;
  64.  
  65. #define YY_END_OF_BUFFER_CHAR 0
  66.  
  67. #ifndef YY_BUF_SIZE
  68. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  69. #endif
  70.  
  71. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  72.  
  73. #define YY_CHAR char
  74. #define INITIAL 0
  75. /*    SCCS Id: @(#)lev_lex.c    3.1    93/06/17    */
  76. /*    Copyright (c) 1989 by Jean-Christophe Collet */
  77. /* NetHack may be freely redistributed.  See license for details. */
  78.  
  79. #define LEV_LEX_C
  80.  
  81. #include "hack.h"
  82. #include "lev_comp.h"
  83. #include "sp_lev.h"
  84.  
  85. /* Most of these don't exist in flex, yywrap is macro and
  86.  * yyunput is properly declared in flex.skel.
  87.  */
  88. #if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
  89. int FDECL(yyback, (int *, int));
  90. int NDECL(yylook);
  91. int NDECL(yyinput);
  92. int NDECL(yywrap);
  93. int NDECL(yylex);
  94.     /* Traditional lexes let yyunput() and yyoutput() default to int;
  95.      * newer ones may declare them as void since they don't return
  96.      * values.  For even more fun, the lex supplied as part of the
  97.      * newer unbundled compiler for SunOS 4.x adds the void declarations
  98.      * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain
  99.      * int) while the bundled lex and the one with the older unbundled
  100.      * compiler do not.  To detect this, we need help from outside --
  101.      * sys/unix/Makefile.utl.
  102.      */
  103. # if defined(NeXT) || defined(SVR4)
  104. #  define VOIDYYPUT
  105. # endif
  106. # if !defined(VOIDYYPUT)
  107. #  if defined(POSIX_TYPES) && !defined(BOS) && !defined(HISX) && !defined(_M_UNIX)
  108. #   define VOIDYYPUT
  109. #  endif
  110. # endif
  111. # if !defined(VOIDYYPUT) && defined(WEIRD_LEX)
  112. #  if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1) 
  113. #   define VOIDYYPUT
  114. #  endif
  115. # endif
  116. # ifdef VOIDYYPUT
  117. void FDECL(yyunput, (int));
  118. void FDECL(yyoutput, (int));
  119. # else
  120. int FDECL(yyunput, (int));
  121. int FDECL(yyoutput, (int));
  122. # endif
  123. #endif    /* !FLEX_SCANNER && !FLEXHACK_SCANNER */
  124.  
  125. void FDECL(init_yyin, (FILE *));
  126. void FDECL(init_yyout, (FILE *));
  127.  
  128. #ifdef MICRO
  129. #undef exit
  130. extern void FDECL(exit, (int));
  131. #endif
  132.  
  133. /*
  134.  * This doesn't always get put in lev_comp.h
  135.  * (esp. when using older versions of bison).
  136.  */
  137. extern YYSTYPE yylval;
  138.  
  139. int line_number = 1, colon_line_number = 1;
  140.  
  141. /*
  142.  * This is *** UGLY *** but I can't think a better way to do it;
  143.  * I really need a huge buffer to scan maps...
  144.  * (This should probably be `#ifndef FLEX_SCANNER' since it's lex-specific.)
  145.  */
  146. #ifdef YYLMAX
  147. #undef YYLMAX
  148. #endif
  149. #define YYLMAX    2048
  150.  
  151. /*
  152.  *    This is a hack required by Michael Hamel to get things
  153.  *    working on the Mac.
  154.  */
  155. #if defined(applec) && !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
  156. #undef input
  157. #undef unput
  158. #define unput(c) { yytchar = (c); if (yytchar == 10) yylineno--; *yysptr++ = yytchar; }
  159. # ifndef YYNEWLINE
  160. # define YYNEWLINE 10
  161. # endif
  162.  
  163. char
  164. input()        /* Under MPW \n is chr(13)! Compensate for this. */
  165. {
  166.     if (yysptr > yysbuf) return(*--yysptr);
  167.     else {
  168.         yytchar = getc(yyin);
  169.         if (yytchar == '\n') {
  170.             yylineno++;
  171.             return(YYNEWLINE);
  172.         }
  173.         if (yytchar == EOF) return(0);
  174.         else            return(yytchar);
  175.     }
  176. }
  177. #endif    /* applec && !FLEX_SCANNER && !FLEXHACK_SCANNER */
  178.  
  179. #define MAPC 1
  180.  
  181. /* done after the current pattern has been matched and before the
  182.  * corresponding action - sets up yytext
  183.  */
  184. #define YY_DO_BEFORE_ACTION \
  185.     yytext = yy_bp; \
  186.     yytext -= yy_more_len; \
  187.     yyleng = yy_cp - yytext; \
  188.     yy_hold_char = *yy_cp; \
  189.     *yy_cp = '\0'; \
  190.     yy_c_buf_p = yy_cp;
  191.  
  192. #define EOB_ACT_CONTINUE_SCAN 0
  193. #define EOB_ACT_END_OF_FILE 1
  194. #define EOB_ACT_LAST_MATCH 2
  195.  
  196. /* return all but the first 'n' matched characters back to the input stream */
  197. #define yyless(n) \
  198.     do { \
  199.         /* undo effects of setting up yytext */ \
  200.         *yy_cp = yy_hold_char; \
  201.         yy_c_buf_p = yy_cp = yy_bp + n; \
  202.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  203.     } while ( 0 )
  204.  
  205. #define unput(c) yyunput((int)c, yytext)
  206.  
  207.  
  208. struct yy_buffer_state {
  209.     FILE *yy_input_file;
  210.  
  211.     YY_CHAR *yy_ch_buf;        /* input buffer */
  212.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  213.  
  214.     /* size of input buffer in bytes, not including room for EOB characters */
  215.     int yy_buf_size;
  216.  
  217.     /* number of characters read into yy_ch_buf, not including EOB characters */
  218.     int yy_n_chars;
  219.  
  220.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  221. #define EOF_NOT_SEEN 0
  222.     /* "pending" happens when the EOF has been seen but there's still
  223.      * some text process
  224.      */
  225. #define EOF_PENDING 1
  226. #define EOF_DONE 2
  227. };
  228.  
  229. static YY_BUFFER_STATE yy_current_buffer;
  230.  
  231. /* we provide macros for accessing buffer states in case in the
  232.  * future we want to put the buffer states in a more general
  233.  * "scanner state"
  234.  */
  235. #define YY_CURRENT_BUFFER yy_current_buffer
  236.  
  237.  
  238. /* yy_hold_char holds the character lost when yytext is formed */
  239. static YY_CHAR yy_hold_char;
  240.  
  241. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  242.  
  243.  
  244. #ifndef YY_USER_ACTION
  245. #define YY_USER_ACTION
  246. #endif
  247.  
  248. #ifndef YY_USER_INIT
  249. #define YY_USER_INIT
  250. #endif
  251.  
  252. extern YY_CHAR *yytext;
  253. extern int yyleng;
  254. extern FILE *yyin, *yyout;
  255.  
  256. YY_CHAR *yytext;
  257. int yyleng;
  258.  
  259. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  260.  
  261. #define YY_END_OF_BUFFER 106
  262. typedef int yy_state_type;
  263. static const short int yy_accept[573] =
  264.     {   0,
  265.         0,    0,    0,    0,  106,  104,  102,  101,  104,  104,
  266.       104,   99,    4,  104,  104,  104,  104,  104,  104,  104,
  267.       104,  104,  104,  104,  104,  104,  104,  104,  104,  104,
  268.       104,  104,  104,  104,  104,  104,  104,  104,  104,  104,
  269.       104,  104,  104,  104,  104,  104,  104,  104,  104,    2,
  270.       102,  104,  104,  104,  104,  104,  104,  104,  104,  104,
  271.       104,  104,  104,  102,    0,  100,    0,   99,    0,    0,
  272.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  273.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  274.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  275.  
  276.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  277.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  278.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  279.         0,    0,    0,    0,    0,    0,    0,    0,   84,    0,
  280.         0,    3,    0,    2,  102,    0,    0,    0,    0,    0,
  281.         0,    0,    2,    0,  103,    0,    0,    0,    0,    0,
  282.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  283.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  284.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  285.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  286.  
  287.         0,    0,    0,    0,    0,    0,    0,    0,   71,    0,
  288.         0,   66,    0,    0,    0,    0,    0,    0,    0,    0,
  289.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  290.         0,    0,    0,    0,    0,   64,    0,    0,    0,    0,
  291.         0,    0,    0,    0,    0,    0,    0,    0,    0,   16,
  292.         0,    0,    0,    0,    0,   39,    0,    0,    0,    6,
  293.         0,    0,   41,    0,    0,    0,   32,    0,    0,    0,
  294.        35,   31,    0,    0,    0,   15,    0,    0,    0,    0,
  295.         0,    0,    0,    0,   90,    0,    0,    0,    0,   85,
  296.        88,   50,    0,    0,    0,    0,    0,    0,   59,    0,
  297.  
  298.         0,    0,    0,    0,   91,    0,    0,    0,    0,    0,
  299.        54,    0,    0,    0,   44,    0,    0,    0,    0,    0,
  300.         0,    0,    0,   87,    0,    0,    0,   52,   12,    0,
  301.         0,   24,    0,    0,    0,    0,    0,   10,    0,    0,
  302.         0,    0,    8,    0,    0,    0,    7,    0,    0,    0,
  303.         0,    0,    0,   26,    0,    0,    0,   58,   83,    0,
  304.        77,    0,    0,    0,    0,   73,    0,    0,    0,   86,
  305.         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  306.         0,    0,    0,    0,   49,    0,    0,    0,   57,    0,
  307.        63,    0,    0,    0,   51,    0,    0,   67,    0,    0,
  308.  
  309.        29,   42,    0,    0,    0,    0,    0,    0,   25,    0,
  310.         0,    0,    0,    0,   13,   27,    0,   20,    0,    0,
  311.         0,   76,    0,   65,   48,   61,   45,   94,    0,   68,
  312.         0,    0,    0,    0,    0,   46,    0,    0,    0,    0,
  313.         0,    0,   47,   97,    0,   55,    0,   53,    0,    0,
  314.        82,    0,    0,    1,    0,    0,    0,    0,    0,    0,
  315.         0,    5,   14,    0,    0,    0,   36,    0,   19,   92,
  316.        89,    0,    0,    0,   75,    0,    0,    0,    0,   56,
  317.        72,   70,    0,    0,   81,    0,    0,    0,   38,    0,
  318.         0,   30,   11,    9,   18,    0,    0,    0,    0,    0,
  319.  
  320.         0,    0,    0,    0,    0,    0,    0,    0,   80,    0,
  321.        74,    0,   93,   69,    0,   40,    0,    0,    0,    0,
  322.         0,    0,    0,   60,    0,   96,   43,   78,   79,    0,
  323.         0,   17,    0,    0,    0,    0,    0,    0,    0,   62,
  324.        95,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  325.        33,   34,    0,    0,    0,    0,    0,   98,    0,    0,
  326.         0,   23,    0,    0,    0,   21,    0,    0,   22,   28,
  327.        37,    0
  328.     } ;
  329.  
  330. static const YY_CHAR yy_ec[128] =
  331.     {   0,
  332.         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
  333.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  334.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  335.         1,    4,    1,    5,    6,    1,    1,    1,    7,    1,
  336.         1,    1,    8,    1,    9,   10,    1,   11,   11,   11,
  337.        11,   11,   11,   11,   11,   11,   11,   12,    1,    1,
  338.         1,    1,    1,    1,   13,   14,   15,   16,   17,   18,
  339.        19,   20,   21,   22,   23,   24,   25,   26,   27,   28,
  340.         1,   29,   30,   31,   32,   33,   34,    1,   35,   36,
  341.         1,   10,    1,    1,   37,    1,   38,   39,   40,   41,
  342.  
  343.        42,   43,   44,   45,   46,   47,   48,   49,   50,   51,
  344.        52,   53,    1,   54,   55,   56,   57,   58,   59,    1,
  345.         1,    1,   10,   10,   10,    1,    1
  346.     } ;
  347.  
  348. static const YY_CHAR yy_meta[60] =
  349.     {   0,
  350.         1,    2,    3,    2,    1,    2,    1,    2,    2,    2,
  351.         1,    1,    2,    2,    2,    1,    1,    1,    1,    2,
  352.         2,    1,    2,    2,    1,    1,    1,    2,    1,    2,
  353.         1,    1,    1,    2,    1,    1,    1,    1,    1,    1,
  354.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  355.         1,    1,    1,    1,    1,    1,    1,    1,    1
  356.     } ;
  357.  
  358. static const short int yy_base[577] =
  359.     {   0,
  360.         0,   54,   77,   57,  674,  675,   60,  675,  668,    0,
  361.       661,  660,  675,  646,  640,   41,   38,  642,   42,   57,
  362.       641,   58,   76,   75,  652,  638,   82,   83,   79,  651,
  363.        57,   68,   79,   20,   72,   32,   75,   88,   81,   87,
  364.        92,   93,  100,   99,   89,   96,  621,  659,  135,  675,
  365.       151,  154,  156,  158,  161,  166,  635,  163,  168,  152,
  366.       156,  161,  191,  171,  655,  675,  652,  647,  626,  643,
  367.       642,  625,  626,  639,  632,  637,  617,  621,  623,  625,
  368.       629,  611,  607,  612,  615,  615,  166,  617,  169,  612,
  369.       618,  609,  609,  621,  619,  608,  618,  606,  157,  580,
  370.  
  371.       590,  585,  570,  573,  570,  572,  584,  569,  566,  560,
  372.       563,  562,  572,  566,  565,  153,  558,  553,  165,  555,
  373.       570,  166,  555,  557,  550,  179,  559,  563,  566,  565,
  374.       551,  557,  549,  170,  542,  545,  540,  188,  675,  541,
  375.       592,  675,  198,  675,  236,  239,  241,  167,   57,  232,
  376.       233,  234,  675,    0,  675,  581,  567,  566,  562,  561,
  377.       555,  559,  568,  560,  560,  568,  552,  566,  564,  563,
  378.       549,  548,  560,  563,  538,  557,  549,  541,  555,  549,
  379.       544,  545,  546,  537,  548,  536,  539,  518,  523,  518,
  380.       511,  503,  501,  508,  504,  498,  501,  497,  496,  499,
  381.  
  382.       493,  492,  493,  491,  496,  501,  502,  486,  675,  485,
  383.       486,  675,  491,  496,  485,  497,  487,  479,  477,  483,
  384.       479,  480,  487,  472,  485,  484,  474,  484,  483,  481,
  385.       476,  480,  465,  472,  461,  675,  474,  458,  468,  467,
  386.       456,  508,  239,  485,  240,  480,  493,  492,  485,  675,
  387.       491,  491,  473,  471,  484,  675,  463,  482,  474,  463,
  388.       483,  464,  675,  466,  238,  478,  675,  479,  464,  463,
  389.       675,  675,  460,  461,  459,  675,  465,  434,  430,  441,
  390.       440,  426,  428,  437,  675,  436,  422,  434,  433,  675,
  391.       675,  675,  436,  431,  430,  462,  427,  423,  675,  426,
  392.  
  393.       425,  428,  414,  417,  675,  407,  408,  415,  408,  421,
  394.       675,  413,  408,  416,  675,  413,  412,  401,  396,  395,
  395.       394,  398,  403,  675,  393,  397,  389,  675,  675,  431,
  396.       250,  675,  423,  425,  425,  411,  406,  675,  425,  406,
  397.       411,  406,  675,  421,  414,  415,  675,  410,  417,  398,
  398.       404,  402,  400,  675,  398,  397,  405,  675,  675,  369,
  399.       675,  379,  370,  368,  364,  675,  376,  375,  357,  675,
  400.       373,  178,  364,  363,  367,  369,  353,  353,  365,  364,
  401.       367,  360,  349,  349,  675,  359,  344,  356,  675,  348,
  402.       675,  340,  341,  353,  675,  339,  344,  675,  364,  256,
  403.  
  404.       675,  675,  364,  369,  368,  367,  358,  373,  675,  361,
  405.       367,  354,  363,  351,  675,  675,  343,  675,  354,  349,
  406.       342,  675,  335,  675,  675,  675,  675,  675,  333,  675,
  407.       332,  327,  320,  329,  324,  675,  312,  312,  327,  312,
  408.       316,  313,  675,  675,  310,  675,  305,  675,  311,  314,
  409.       675,  317,  316,  675,  328,  340,  329,  328,  318,  324,
  410.       328,  675,  675,  331,  319,  253,  675,  317,  675,  675,
  411.       675,  304,  302,  293,  675,  292,  289,  300,  285,  675,
  412.       675,  675,  288,  290,  675,  294,  296,  295,  675,  316,
  413.       315,  675,  675,  675,  675,  320,  298,  304,  303,  315,
  414.  
  415.       304,  290,  270,  280,  270,  272,  280,  267,  675,  266,
  416.       675,  274,  675,  675,  301,  675,  303,  303,  286,  288,
  417.       291,  299,  282,  675,  254,  675,  675,  675,  675,  253,
  418.       252,  675,  283,  282,  276,  274,  286,  287,  284,  675,
  419.       675,  258,  282,  274,  276,  265,  280,  277,  274,  251,
  420.       675,  675,  263,  260,  245,  245,  249,  675,  235,  232,
  421.       230,  675,  228,  207,  180,  675,  124,  102,  675,  675,
  422.       675,  675,  281,  284,  286,  288
  423.     } ;
  424.  
  425. static const short int yy_def[577] =
  426.     {   0,
  427.       572,    1,    1,    3,  572,  572,  572,  572,  573,  574,
  428.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  429.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  430.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  431.       572,  572,  572,  572,  572,  572,  572,  575,  572,  572,
  432.       576,  576,  576,  576,  576,  576,  572,  576,  576,   56,
  433.        56,   59,  575,  572,  573,  572,  572,  572,  572,  572,
  434.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  435.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  436.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  437.  
  438.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  439.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  440.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  441.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  442.       575,  572,  572,  572,  576,  576,  576,   59,  572,   59,
  443.        59,   59,  572,   63,  572,  572,  572,  572,  572,  572,
  444.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  445.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  446.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  447.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  448.  
  449.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  450.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  451.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  452.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  453.       572,  572,   59,  572,   59,  572,  572,  572,  572,  572,
  454.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  455.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  456.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  457.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  458.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  459.  
  460.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  461.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  462.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  463.        59,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  464.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  465.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  466.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  467.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  468.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  469.       572,  572,  572,  572,  572,  572,  572,  572,  572,   59,
  470.  
  471.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  472.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  473.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  474.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  475.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  476.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  477.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  478.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  479.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  480.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  481.  
  482.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  483.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  484.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  485.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  486.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  487.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  488.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  489.       572,    0,  572,  572,  572,  572
  490.     } ;
  491.  
  492. static const short int yy_nxt[735] =
  493.     {   0,
  494.         6,    7,    8,    7,    9,    6,   10,   11,   11,    6,
  495.        12,   13,   14,   15,   16,   17,   18,   19,   20,    6,
  496.        21,    6,    6,   22,   23,   24,   25,   26,   27,   28,
  497.        29,    6,    6,   30,    6,    6,    6,   31,   32,   33,
  498.        34,   35,   36,    6,   37,    6,    6,    6,   38,   39,
  499.        40,   41,   42,   43,   44,   45,   46,    6,   47,   48,
  500.        71,   64,   63,   64,   73,   76,   74,   72,   77,  114,
  501.        81,  110,  244,   78,   82,  162,  111,  115,   49,   50,
  502.        51,   49,   52,   79,   53,   53,   52,   86,   83,   54,
  503.        55,   56,   84,   57,   90,   96,   52,   58,   91,   52,
  504.  
  505.        59,   87,   85,   93,   60,   99,   61,   97,   92,  112,
  506.        62,  100,  116,   94,   95,  101,  102,  122,  123,  103,
  507.       106,  104,  113,  107,  105,  118,  117,  108,  125,  119,
  508.       127,  571,  124,  120,  129,  109,  133,  131,  126,  121,
  509.       136,  130,  137,  134,  128,  132,  138,  143,  139,  570,
  510.       135,   84,   64,  144,  145,  572,  144,  572,  144,  572,
  511.       144,   85,  572,  144,  572,  144,   68,  572,  144,  572,
  512.       144,  146,   64,  152,   64,  146,  151,  572,   89,  243,
  513.       150,  147,  572,  572,   82,  148,   94,   95,   80,   70,
  514.       174,  175,   72,  153,  154,  177,  154,  178,  154,  154,
  515.  
  516.       154,  206,  188,  154,  154,  154,  207,  210,  214,  569,
  517.       154,  154,  189,  154,  154,  215,  220,  216,  154,  221,
  518.       154,  233,  211,  234,  154,  242,  431,  238,  222,  223,
  519.       239,  432,  224,  170,  225,  568,  240,   64,  144,  145,
  520.       572,  144,  572,  144,  146,  146,  146,  168,  572,  572,
  521.       572,  146,  146,  348,  567,  572,  572,  245,  182,  566,
  522.       565,  564,  146,  331,  248,  349,  572,  498,  146,  563,
  523.       400,  156,  572,  421,  562,  561,  560,  499,  559,  500,
  524.       501,   65,   65,   65,   67,   67,  141,  141,  141,  146,
  525.       146,  558,  557,  556,  555,  554,  553,  552,  551,  550,
  526.  
  527.       549,  548,  547,  546,  545,  544,  543,  542,  541,  540,
  528.       539,  538,  537,  536,  535,  534,  533,  532,  531,  530,
  529.       529,  528,  527,  526,  525,  524,  523,  522,  521,  520,
  530.       519,  518,  517,  516,  515,  514,  513,  512,  511,  510,
  531.       509,  508,  507,  506,  505,  504,  503,  502,  497,  496,
  532.       495,  494,  493,  492,  491,  490,  489,  488,  487,  486,
  533.       485,  484,  483,  482,  481,  480,  479,  478,  477,  476,
  534.       475,  474,  473,  472,  471,  470,  469,  468,  467,  466,
  535.       465,  464,  463,  462,  461,  460,  459,  458,  457,  456,
  536.       455,  454,  453,  452,  451,  450,  449,  448,  447,  446,
  537.  
  538.       445,  444,  443,  442,  441,  440,  439,  438,  437,  436,
  539.       435,  434,  433,  430,  429,  428,  427,  426,  425,  424,
  540.       423,  422,  421,  420,  419,  418,  417,  416,  415,  414,
  541.       413,  412,  411,  410,  409,  408,  407,  406,  405,  404,
  542.       403,  402,  401,  399,  398,  397,  396,  395,  394,  393,
  543.       392,  391,  390,  389,  388,  387,  386,  385,  384,  383,
  544.       382,  381,  380,  379,  378,  377,  376,  375,  374,  373,
  545.       372,  371,  370,  369,  368,  367,  366,  365,  364,  363,
  546.       362,  361,  360,  359,  358,  357,  356,  355,  354,  353,
  547.       352,  351,  350,  347,  346,  345,  344,  343,  342,  341,
  548.  
  549.       340,  339,  338,  337,  336,  335,  334,  333,  332,  330,
  550.       329,  328,  327,  326,  325,  324,  323,  322,  321,  320,
  551.       319,  318,  317,  316,  315,  314,  313,  312,  311,  310,
  552.       309,  308,  307,  306,  305,  304,  303,  302,  301,  300,
  553.       299,  298,  297,  296,  295,  294,  293,  292,  291,  290,
  554.       289,  288,  287,  286,  285,  284,  283,  282,  281,  280,
  555.       279,  278,  277,  276,  275,  274,  273,  272,  271,  270,
  556.       269,  268,  267,  266,  265,  264,  263,  262,  261,  260,
  557.       259,  258,  257,  256,  255,  254,  253,  252,  251,  250,
  558.       249,  248,  247,  246,  142,  241,  237,  236,  235,  232,
  559.  
  560.       231,  230,  229,  228,  227,  226,  219,  218,  217,  213,
  561.       212,  209,  208,  205,  204,  203,  202,  201,  200,  199,
  562.       198,  197,  196,  195,  194,  193,  192,  191,  190,  187,
  563.       186,  185,  184,  183,  182,  181,  180,  179,  176,  173,
  564.       172,  171,  170,  169,  168,  167,  166,  165,  164,  163,
  565.       162,  161,  160,  159,  158,  157,  156,   68,  155,   66,
  566.       149,  142,  140,   98,   89,   88,   80,   75,   70,   69,
  567.        68,   68,   66,  572,    5,  572,  572,  572,  572,  572,
  568.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  569.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  570.  
  571.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  572.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  573.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  574.       572,  572,  572,  572
  575.     } ;
  576.  
  577. static const short int yy_chk[735] =
  578.     {   0,
  579.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  580.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  581.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  582.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  583.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  584.         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
  585.        16,    7,    4,    7,   17,   19,   17,   16,   19,   36,
  586.        22,   34,  149,   20,   22,  149,   34,   36,    2,    3,
  587.         3,    4,    3,   20,    3,    3,    3,   24,   23,    3,
  588.         3,    3,   23,    3,   27,   29,    3,    3,   27,    3,
  589.  
  590.         3,   24,   23,   28,    3,   31,    3,   29,   27,   35,
  591.         3,   31,   37,   28,   28,   31,   32,   39,   39,   32,
  592.        33,   32,   35,   33,   32,   38,   37,   33,   40,   38,
  593.        41,  568,   39,   38,   42,   33,   44,   43,   40,   38,
  594.        45,   42,   45,   44,   41,   43,   46,   49,   46,  567,
  595.        44,   49,   51,   51,   51,   52,   52,   53,   53,   54,
  596.        54,   49,   55,   55,   58,   58,   53,   56,   56,   59,
  597.        59,   60,   64,   62,   64,   61,   61,   62,   60,  148,
  598.        59,   54,   61,  148,   59,   56,   61,   61,   58,   55,
  599.        87,   87,   56,   63,   63,   89,   63,   89,   63,   63,
  600.  
  601.        63,  116,   99,   63,   63,   63,  116,  119,  122,  565,
  602.        63,   63,   99,   63,   63,  122,  126,  122,   63,  126,
  603.        63,  134,  119,  134,   63,  143,  372,  138,  126,  126,
  604.       138,  372,  126,  143,  126,  564,  138,  145,  145,  145,
  605.       146,  146,  147,  147,  150,  151,  152,  150,  150,  151,
  606.       152,  243,  245,  265,  563,  243,  245,  152,  151,  561,
  607.       560,  559,  331,  245,  243,  265,  331,  466,  400,  557,
  608.       331,  147,  400,  400,  556,  555,  554,  466,  553,  466,
  609.       466,  573,  573,  573,  574,  574,  575,  575,  575,  576,
  610.       576,  550,  549,  548,  547,  546,  545,  544,  543,  542,
  611.  
  612.       539,  538,  537,  536,  535,  534,  533,  531,  530,  525,
  613.       523,  522,  521,  520,  519,  518,  517,  515,  512,  510,
  614.       508,  507,  506,  505,  504,  503,  502,  501,  500,  499,
  615.       498,  497,  496,  491,  490,  488,  487,  486,  484,  483,
  616.       479,  478,  477,  476,  474,  473,  472,  468,  465,  464,
  617.       461,  460,  459,  458,  457,  456,  455,  453,  452,  450,
  618.       449,  447,  445,  442,  441,  440,  439,  438,  437,  435,
  619.       434,  433,  432,  431,  429,  423,  421,  420,  419,  417,
  620.       414,  413,  412,  411,  410,  408,  407,  406,  405,  404,
  621.       403,  399,  397,  396,  394,  393,  392,  390,  388,  387,
  622.  
  623.       386,  384,  383,  382,  381,  380,  379,  378,  377,  376,
  624.       375,  374,  373,  371,  369,  368,  367,  365,  364,  363,
  625.       362,  360,  357,  356,  355,  353,  352,  351,  350,  349,
  626.       348,  346,  345,  344,  342,  341,  340,  339,  337,  336,
  627.       335,  334,  333,  330,  327,  326,  325,  323,  322,  321,
  628.       320,  319,  318,  317,  316,  314,  313,  312,  310,  309,
  629.       308,  307,  306,  304,  303,  302,  301,  300,  298,  297,
  630.       296,  295,  294,  293,  289,  288,  287,  286,  284,  283,
  631.       282,  281,  280,  279,  278,  277,  275,  274,  273,  270,
  632.       269,  268,  266,  264,  262,  261,  260,  259,  258,  257,
  633.  
  634.       255,  254,  253,  252,  251,  249,  248,  247,  246,  244,
  635.       242,  241,  240,  239,  238,  237,  235,  234,  233,  232,
  636.       231,  230,  229,  228,  227,  226,  225,  224,  223,  222,
  637.       221,  220,  219,  218,  217,  216,  215,  214,  213,  211,
  638.       210,  208,  207,  206,  205,  204,  203,  202,  201,  200,
  639.       199,  198,  197,  196,  195,  194,  193,  192,  191,  190,
  640.       189,  188,  187,  186,  185,  184,  183,  182,  181,  180,
  641.       179,  178,  177,  176,  175,  174,  173,  172,  171,  170,
  642.       169,  168,  167,  166,  165,  164,  163,  162,  161,  160,
  643.       159,  158,  157,  156,  141,  140,  137,  136,  135,  133,
  644.  
  645.       132,  131,  130,  129,  128,  127,  125,  124,  123,  121,
  646.       120,  118,  117,  115,  114,  113,  112,  111,  110,  109,
  647.       108,  107,  106,  105,  104,  103,  102,  101,  100,   98,
  648.        97,   96,   95,   94,   93,   92,   91,   90,   88,   86,
  649.        85,   84,   83,   82,   81,   80,   79,   78,   77,   76,
  650.        75,   74,   73,   72,   71,   70,   69,   68,   67,   65,
  651.        57,   48,   47,   30,   26,   25,   21,   18,   15,   14,
  652.        12,   11,    9,    5,  572,  572,  572,  572,  572,  572,
  653.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  654.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  655.  
  656.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  657.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  658.       572,  572,  572,  572,  572,  572,  572,  572,  572,  572,
  659.       572,  572,  572,  572
  660.     } ;
  661.  
  662. static yy_state_type yy_last_accepting_state;
  663. static YY_CHAR *yy_last_accepting_cpos;
  664.  
  665. /* the intent behind this definition is that it'll catch
  666.  * any uses of REJECT which flex missed
  667.  */
  668. #define REJECT reject_used_but_not_detected
  669. static int yy_more_flag = 0;
  670. static int yy_doing_yy_more = 0;
  671. static int yy_more_len = 0;
  672. #define yymore() { yy_more_flag = 1; }
  673. #define YY_MORE_ADJ (yy_doing_yy_more ? yy_more_len : 0)
  674.  
  675. /* these variables are all declared out here so that section 3 code can
  676.  * manipulate them
  677.  */
  678. /* points to current character in buffer */
  679. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  680. static int yy_init = 1;        /* whether we need to initialize */
  681. static int yy_start = 0;    /* start state number */
  682.  
  683. /* flag which is used to allow yywrap()'s to do buffer switches
  684.  * instead of setting up a fresh yyin.  A bit of a hack ...
  685.  */
  686. static int yy_did_buffer_switch_on_eof;
  687.  
  688. static yy_state_type NDECL(yy_get_previous_state);
  689. static yy_state_type FDECL(yy_try_NUL_trans, (yy_state_type));
  690. static int NDECL(yy_get_next_buffer);
  691. #if 0        /* not needed for NetHack */
  692. static int NDECL(yyinput);
  693. static void FDECL(yyunput, (int,YY_CHAR *));
  694. #endif
  695. void FDECL(yyrestart, (FILE *));
  696. void FDECL(yy_switch_to_buffer, (YY_BUFFER_STATE));
  697. void NDECL(yy_load_buffer_state);
  698. YY_BUFFER_STATE FDECL(yy_create_buffer, (FILE *,int));
  699. void FDECL(yy_delete_buffer, (YY_BUFFER_STATE));
  700. void FDECL(yy_init_buffer, (YY_BUFFER_STATE,FILE *));
  701.  
  702. #define yy_new_buffer yy_create_buffer
  703.  
  704. YY_DECL
  705. {
  706.     register yy_state_type yy_current_state;
  707.     register YY_CHAR *yy_cp, *yy_bp;
  708.     register int yy_act;
  709.  
  710.  
  711.  
  712.     if ( yy_init )
  713.     {
  714.     YY_USER_INIT;
  715.  
  716.     if ( ! yy_start )
  717.         yy_start = 1;    /* first start state */
  718.  
  719.     if ( ! yyin )
  720.         yyin = stdin;
  721.  
  722.     if ( ! yyout )
  723.         yyout = stdout;
  724.  
  725.     if ( yy_current_buffer )
  726.         yy_init_buffer( yy_current_buffer, yyin );
  727.     else
  728.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  729.  
  730.     yy_load_buffer_state();
  731.  
  732.     yy_init = 0;
  733.     }
  734.  
  735.     while ( 1 )        /* loops until end-of-file is reached */
  736.     {
  737.     yy_more_len = 0;
  738.     yy_doing_yy_more = yy_more_flag;
  739.     if ( yy_doing_yy_more )
  740.         {
  741.         yy_more_len = yyleng;
  742.         yy_more_flag = 0;
  743.         }
  744.     yy_cp = yy_c_buf_p;
  745.  
  746.     /* support of yytext */
  747.     *yy_cp = yy_hold_char;
  748.  
  749.     /* yy_bp points to the position in yy_ch_buf of the start of the
  750.      * current run.
  751.      */
  752.     yy_bp = yy_cp;
  753.  
  754.     yy_current_state = yy_start;
  755.     if ( yy_bp[-1] == '\n' )
  756.         ++yy_current_state;
  757. yy_match:
  758.     do
  759.         {
  760.         register YY_CHAR yy_c = yy_ec[*yy_cp];
  761.         if ( yy_accept[yy_current_state] )
  762.         {
  763.         yy_last_accepting_state = yy_current_state;
  764.         yy_last_accepting_cpos = yy_cp;
  765.         }
  766.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  767.         {
  768.         yy_current_state = yy_def[yy_current_state];
  769.         if ( yy_current_state >= 573 )
  770.             yy_c = yy_meta[yy_c];
  771.         }
  772.         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  773.         ++yy_cp;
  774.         }
  775.     while ( yy_current_state != 572 );
  776.     yy_cp = yy_last_accepting_cpos;
  777.     yy_current_state = yy_last_accepting_state;
  778.  
  779. yy_find_action:
  780.     yy_act = yy_accept[yy_current_state];
  781.  
  782.     YY_DO_BEFORE_ACTION;
  783.     YY_USER_ACTION;
  784.  
  785. do_action:    /* this label is used only to access EOF actions */
  786.  
  787.  
  788.     switch ( yy_act )
  789.         {
  790.         case 0: /* must backtrack */
  791.         /* undo the effects of YY_DO_BEFORE_ACTION */
  792.         *yy_cp = yy_hold_char;
  793.         yy_cp = yy_last_accepting_cpos;
  794.         yy_current_state = yy_last_accepting_state;
  795.         goto yy_find_action;
  796.  
  797. case 1:
  798. {
  799. #ifdef FLEX23_BUG
  800.           /*
  801.            * There is a bug in Flex 2.3 patch level < 6
  802.            * (absent in previous versions)
  803.            * that results in the following behaviour :
  804.            * Once you enter an yymore(), you never exit from it.
  805.            * This should do the trick!
  806.            */
  807.           extern int yy_more_len;
  808.  
  809.           yy_more_len = 0;
  810. #endif    /* FLEX23_BUG */
  811.           BEGIN(INITIAL);
  812.           yylval.map = (char *) alloc(yyleng-5);
  813.           strncpy(yylval.map, yytext,yyleng-6);
  814.           yylval.map[yyleng-6] = 0;
  815.           return MAP_ID;
  816.         }
  817.     YY_BREAK
  818. case 2:
  819. { line_number++; yymore(); }
  820.     YY_BREAK
  821. case 3:
  822. { line_number++; }
  823.     YY_BREAK
  824. case 4:
  825. { colon_line_number = line_number; return ':'; }
  826.     YY_BREAK
  827. case 5:
  828. return MESSAGE_ID;
  829.     YY_BREAK
  830. case 6:
  831. return MAZE_ID;
  832.     YY_BREAK
  833. case 7:
  834. return NOMAP_ID;
  835.     YY_BREAK
  836. case 8:
  837. return LEVEL_ID;
  838.     YY_BREAK
  839. case 9:
  840. return LEV_INIT_ID;
  841.     YY_BREAK
  842. case 10:
  843. return FLAGS_ID;
  844.     YY_BREAK
  845. case 11:
  846. return GEOMETRY_ID;
  847.     YY_BREAK
  848. case 12:
  849. { BEGIN(MAPC); line_number++; }
  850.     YY_BREAK
  851. case 13:
  852. return OBJECT_ID;
  853.     YY_BREAK
  854. case 14:
  855. return MONSTER_ID;
  856.     YY_BREAK
  857. case 15:
  858. return TRAP_ID;
  859.     YY_BREAK
  860. case 16:
  861. return DOOR_ID;
  862.     YY_BREAK
  863. case 17:
  864. return DRAWBRIDGE_ID;
  865.     YY_BREAK
  866. case 18:
  867. return MAZEWALK_ID;
  868.     YY_BREAK
  869. case 19:
  870. return WALLIFY_ID;
  871.     YY_BREAK
  872. case 20:
  873. return REGION_ID;
  874.     YY_BREAK
  875. case 21:
  876. return RANDOM_OBJECTS_ID;
  877.     YY_BREAK
  878. case 22:
  879. return RANDOM_MONSTERS_ID;
  880.     YY_BREAK
  881. case 23:
  882. return RANDOM_PLACES_ID;
  883.     YY_BREAK
  884. case 24:
  885. return ALTAR_ID;
  886.     YY_BREAK
  887. case 25:
  888. return LADDER_ID;
  889.     YY_BREAK
  890. case 26:
  891. return STAIR_ID;
  892.     YY_BREAK
  893. case 27:
  894. return PORTAL_ID;
  895.     YY_BREAK
  896. case 28:
  897. return TELEPRT_ID;
  898.     YY_BREAK
  899. case 29:
  900. return BRANCH_ID;
  901.     YY_BREAK
  902. case 30:
  903. return FOUNTAIN_ID;
  904.     YY_BREAK
  905. case 31:
  906. return SINK_ID;
  907.     YY_BREAK
  908. case 32:
  909. return POOL_ID;
  910.     YY_BREAK
  911. case 33:
  912. return NON_DIGGABLE_ID;
  913.     YY_BREAK
  914. case 34:
  915. return NON_PASSWALL_ID;
  916.     YY_BREAK
  917. case 35:
  918. return ROOM_ID;
  919.     YY_BREAK
  920. case 36:
  921. return SUBROOM_ID;
  922.     YY_BREAK
  923. case 37:
  924. return RAND_CORRIDOR_ID;
  925.     YY_BREAK
  926. case 38:
  927. return CORRIDOR_ID;
  928.     YY_BREAK
  929. case 39:
  930. return GOLD_ID;
  931.     YY_BREAK
  932. case 40:
  933. return ENGRAVING_ID;
  934.     YY_BREAK
  935. case 41:
  936. return NAME_ID;
  937.     YY_BREAK
  938. case 42:
  939. return CHANCE_ID;
  940.     YY_BREAK
  941. case 43:
  942. return LEV;
  943.     YY_BREAK
  944. case 44:
  945. { yylval.i=D_ISOPEN; return DOOR_STATE; }
  946.     YY_BREAK
  947. case 45:
  948. { yylval.i=D_CLOSED; return DOOR_STATE; }
  949.     YY_BREAK
  950. case 46:
  951. { yylval.i=D_LOCKED; return DOOR_STATE; }
  952.     YY_BREAK
  953. case 47:
  954. { yylval.i=D_NODOOR; return DOOR_STATE; }
  955.     YY_BREAK
  956. case 48:
  957. { yylval.i=D_BROKEN; return DOOR_STATE; }
  958.     YY_BREAK
  959. case 49:
  960. { yylval.i=W_NORTH; return DIRECTION; }
  961.     YY_BREAK
  962. case 50:
  963. { yylval.i=W_EAST; return DIRECTION; }
  964.     YY_BREAK
  965. case 51:
  966. { yylval.i=W_SOUTH; return DIRECTION; }
  967.     YY_BREAK
  968. case 52:
  969. { yylval.i=W_WEST; return DIRECTION; }
  970.     YY_BREAK
  971. case 53:
  972. { yylval.i = -1; return RANDOM_TYPE; }
  973.     YY_BREAK
  974. case 54:
  975. { yylval.i = -2; return NONE; }
  976.     YY_BREAK
  977. case 55:
  978. return O_REGISTER;
  979.     YY_BREAK
  980. case 56:
  981. return M_REGISTER;
  982.     YY_BREAK
  983. case 57:
  984. return P_REGISTER;
  985.     YY_BREAK
  986. case 58:
  987. return A_REGISTER;
  988.     YY_BREAK
  989. case 59:
  990. { yylval.i=1; return LEFT_OR_RIGHT; }
  991.     YY_BREAK
  992. case 60:
  993. { yylval.i=2; return LEFT_OR_RIGHT; }
  994.     YY_BREAK
  995. case 61:
  996. { yylval.i=3; return CENTER; }
  997.     YY_BREAK
  998. case 62:
  999. { yylval.i=4; return LEFT_OR_RIGHT; }
  1000.     YY_BREAK
  1001. case 63:
  1002. { yylval.i=5; return LEFT_OR_RIGHT; }
  1003.     YY_BREAK
  1004. case 64:
  1005. { yylval.i=1; return TOP_OR_BOT; }
  1006.     YY_BREAK
  1007. case 65:
  1008. { yylval.i=5; return TOP_OR_BOT; }
  1009.     YY_BREAK
  1010. case 66:
  1011. { yylval.i=1; return LIGHT_STATE; }
  1012.     YY_BREAK
  1013. case 67:
  1014. { yylval.i=0; return LIGHT_STATE; }
  1015.     YY_BREAK
  1016. case 68:
  1017. { yylval.i=0; return FILLING; }
  1018.     YY_BREAK
  1019. case 69:
  1020. { yylval.i=1; return FILLING; }
  1021.     YY_BREAK
  1022. case 70:
  1023. { yylval.i= AM_NONE; return ALIGNMENT; }
  1024.     YY_BREAK
  1025. case 71:
  1026. { yylval.i= AM_LAWFUL; return ALIGNMENT; }
  1027.     YY_BREAK
  1028. case 72:
  1029. { yylval.i= AM_NEUTRAL; return ALIGNMENT; }
  1030.     YY_BREAK
  1031. case 73:
  1032. { yylval.i= AM_CHAOTIC; return ALIGNMENT; }
  1033.     YY_BREAK
  1034. case 74:
  1035. { yylval.i=1; return MON_ATTITUDE; }
  1036.     YY_BREAK
  1037. case 75:
  1038. { yylval.i=0; return MON_ATTITUDE; }
  1039.     YY_BREAK
  1040. case 76:
  1041. { yylval.i=1; return MON_ALERTNESS; }
  1042.     YY_BREAK
  1043. case 77:
  1044. { yylval.i=0; return MON_ALERTNESS; }
  1045.     YY_BREAK
  1046. case 78:
  1047. { yylval.i= M_AP_FURNITURE; return MON_APPEARANCE; }
  1048.     YY_BREAK
  1049. case 79:
  1050. { yylval.i= M_AP_MONSTER;   return MON_APPEARANCE; }
  1051.     YY_BREAK
  1052. case 80:
  1053. { yylval.i= M_AP_OBJECT;    return MON_APPEARANCE; }
  1054.     YY_BREAK
  1055. case 81:
  1056. { yylval.i=2; return ALTAR_TYPE; }
  1057.     YY_BREAK
  1058. case 82:
  1059. { yylval.i=1; return ALTAR_TYPE; }
  1060.     YY_BREAK
  1061. case 83:
  1062. { yylval.i=0; return ALTAR_TYPE; }
  1063.     YY_BREAK
  1064. case 84:
  1065. { yylval.i=1; return UP_OR_DOWN; }
  1066.     YY_BREAK
  1067. case 85:
  1068. { yylval.i=0; return UP_OR_DOWN; }
  1069.     YY_BREAK
  1070. case 86:
  1071. { yylval.i=0; return BOOLEAN; }
  1072.     YY_BREAK
  1073. case 87:
  1074. { yylval.i=1; return BOOLEAN; }
  1075.     YY_BREAK
  1076. case 88:
  1077. { yylval.i=DUST; return ENGRAVING_TYPE; }
  1078.     YY_BREAK
  1079. case 89:
  1080. { yylval.i=ENGRAVE; return ENGRAVING_TYPE; }
  1081.     YY_BREAK
  1082. case 90:
  1083. { yylval.i=BURN; return ENGRAVING_TYPE; }
  1084.     YY_BREAK
  1085. case 91:
  1086. { yylval.i=MARK; return ENGRAVING_TYPE; }
  1087.     YY_BREAK
  1088. case 92:
  1089. { yylval.i=1; return CURSE_TYPE; }
  1090.     YY_BREAK
  1091. case 93:
  1092. { yylval.i=2; return CURSE_TYPE; }
  1093.     YY_BREAK
  1094. case 94:
  1095. { yylval.i=3; return CURSE_TYPE; }
  1096.     YY_BREAK
  1097. case 95:
  1098. { yylval.i=NOTELEPORT; return FLAG_TYPE; }
  1099.     YY_BREAK
  1100. case 96:
  1101. { yylval.i=HARDFLOOR; return FLAG_TYPE; }
  1102.     YY_BREAK
  1103. case 97:
  1104. { yylval.i=NOMMAP; return FLAG_TYPE; }
  1105.     YY_BREAK
  1106. case 98:
  1107. { yylval.i=SHORTSIGHTED; return FLAG_TYPE; }
  1108.     YY_BREAK
  1109. case 99:
  1110. { yylval.i=atoi(yytext); return INTEGER; }
  1111.     YY_BREAK
  1112. case 100:
  1113. { yytext[yyleng-1] = 0; /* Discard the trailing \" */
  1114.           yylval.map = (char *) alloc(strlen(yytext+1)+1);
  1115.           strcpy(yylval.map, yytext+1); /* Discard the first \" */
  1116.           return STRING; }
  1117.     YY_BREAK
  1118. case 101:
  1119. { line_number++; }
  1120.     YY_BREAK
  1121. case 102:
  1122. ;
  1123.     YY_BREAK
  1124. case 103:
  1125. { yylval.i = yytext[1]; return CHAR; }
  1126.     YY_BREAK
  1127. case 104:
  1128. { return yytext[0]; }
  1129.     YY_BREAK
  1130. case 105:
  1131. ECHO;
  1132.     YY_BREAK
  1133. case YY_STATE_EOF(INITIAL):
  1134. case YY_STATE_EOF(MAPC):
  1135.     yyterminate();
  1136.  
  1137.         case YY_END_OF_BUFFER:
  1138.         {
  1139.         /* amount of text matched not including the EOB char */
  1140.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  1141.  
  1142.         /* undo the effects of YY_DO_BEFORE_ACTION */
  1143.         *yy_cp = yy_hold_char;
  1144.  
  1145.         /* note that here we test for yy_c_buf_p "<=" to the position
  1146.          * of the first EOB in the buffer, since yy_c_buf_p will
  1147.          * already have been incremented past the NUL character
  1148.          * (since all states make transitions on EOB to the end-
  1149.          * of-buffer state).  Contrast this with the test in yyinput().
  1150.          */
  1151.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1152.             /* this was really a NUL */
  1153.             {
  1154.             yy_state_type yy_next_state;
  1155.  
  1156.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1157.  
  1158.             yy_current_state = yy_get_previous_state();
  1159.  
  1160.             /* okay, we're now positioned to make the
  1161.              * NUL transition.  We couldn't have
  1162.              * yy_get_previous_state() go ahead and do it
  1163.              * for us because it doesn't know how to deal
  1164.              * with the possibility of jamming (and we
  1165.              * don't want to build jamming into it because
  1166.              * then it will run more slowly)
  1167.              */
  1168.  
  1169.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  1170.  
  1171.             yy_bp = yytext + YY_MORE_ADJ;
  1172.  
  1173.             if ( yy_next_state )
  1174.             {
  1175.             /* consume the NUL */
  1176.             yy_cp = ++yy_c_buf_p;
  1177.             yy_current_state = yy_next_state;
  1178.             goto yy_match;
  1179.             }
  1180.  
  1181.             else
  1182.             {
  1183.                 yy_cp = yy_last_accepting_cpos;
  1184.                 yy_current_state = yy_last_accepting_state;
  1185.             goto yy_find_action;
  1186.             }
  1187.             }
  1188.  
  1189.         else switch ( yy_get_next_buffer() )
  1190.             {
  1191.             case EOB_ACT_END_OF_FILE:
  1192.             {
  1193.             yy_did_buffer_switch_on_eof = 0;
  1194.  
  1195.             if ( yywrap() )
  1196.                 {
  1197.                 /* note: because we've taken care in
  1198.                  * yy_get_next_buffer() to have set up yytext,
  1199.                  * we can now set up yy_c_buf_p so that if some
  1200.                  * total hoser (like flex itself) wants
  1201.                  * to call the scanner after we return the
  1202.                  * YY_NULL, it'll still work - another YY_NULL
  1203.                  * will get returned.
  1204.                  */
  1205.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  1206.  
  1207.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  1208.                 goto do_action;
  1209.                 }
  1210.  
  1211.             else
  1212.                 {
  1213.                 if ( ! yy_did_buffer_switch_on_eof )
  1214.                 YY_NEW_FILE;
  1215.                 }
  1216.             }
  1217.             break;
  1218.  
  1219.             case EOB_ACT_CONTINUE_SCAN:
  1220.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  1221.  
  1222.             yy_current_state = yy_get_previous_state();
  1223.  
  1224.             yy_cp = yy_c_buf_p;
  1225.             yy_bp = yytext + YY_MORE_ADJ;
  1226.             goto yy_match;
  1227.  
  1228.             case EOB_ACT_LAST_MATCH:
  1229.             yy_c_buf_p =
  1230.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  1231.  
  1232.             yy_current_state = yy_get_previous_state();
  1233.  
  1234.             yy_cp = yy_c_buf_p;
  1235.             yy_bp = yytext + YY_MORE_ADJ;
  1236.             goto yy_find_action;
  1237.             }
  1238.         break;
  1239.         }
  1240.  
  1241.         default:
  1242. #ifdef FLEX_DEBUG
  1243.         printf( "action # %d\n", yy_act );
  1244. #endif
  1245.         YY_FATAL_ERROR(
  1246.             "fatal flex scanner internal error--no action found" );
  1247.         }
  1248.     }
  1249. }
  1250.  
  1251.  
  1252. /* yy_get_next_buffer - try to read in a new buffer
  1253.  *
  1254.  * synopsis
  1255.  *     int yy_get_next_buffer();
  1256.  *
  1257.  * returns a code representing an action
  1258.  *     EOB_ACT_LAST_MATCH -
  1259.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1260.  *     EOB_ACT_END_OF_FILE - end of file
  1261.  */
  1262.  
  1263. static int yy_get_next_buffer()
  1264. {
  1265.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  1266.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  1267.     register int number_to_move, i;
  1268.     int ret_val;
  1269.  
  1270.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  1271.     YY_FATAL_ERROR(
  1272.         "fatal flex scanner internal error--end of buffer missed" );
  1273.  
  1274.     /* try to read more data */
  1275.  
  1276.     /* first move last chars to start of buffer */
  1277.     number_to_move = yy_c_buf_p - yytext;
  1278.  
  1279.     for ( i = 0; i < number_to_move; ++i )
  1280.     *(dest++) = *(source++);
  1281.  
  1282.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  1283.     /* don't do the read, it's not guaranteed to return an EOF,
  1284.      * just force an EOF
  1285.      */
  1286.     yy_n_chars = 0;
  1287.  
  1288.     else
  1289.     {
  1290.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  1291.  
  1292.     if ( num_to_read > YY_READ_BUF_SIZE )
  1293.         num_to_read = YY_READ_BUF_SIZE;
  1294.  
  1295.     else if ( num_to_read <= 0 )
  1296.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  1297.  
  1298.     /* read in more data */
  1299.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  1300.           yy_n_chars, num_to_read );
  1301.     }
  1302.  
  1303.     if ( yy_n_chars == 0 )
  1304.     {
  1305.     if ( number_to_move - YY_MORE_ADJ == 1 )
  1306.         {
  1307.         ret_val = EOB_ACT_END_OF_FILE;
  1308.         yy_current_buffer->yy_eof_status = EOF_DONE;
  1309.         }
  1310.  
  1311.     else
  1312.         {
  1313.         ret_val = EOB_ACT_LAST_MATCH;
  1314.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  1315.         }
  1316.     }
  1317.  
  1318.     else
  1319.     ret_val = EOB_ACT_CONTINUE_SCAN;
  1320.  
  1321.     yy_n_chars += number_to_move;
  1322.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1323.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1324.  
  1325.     /* yytext begins at the second character in yy_ch_buf; the first
  1326.      * character is the one which preceded it before reading in the latest
  1327.      * buffer; it needs to be kept around in case it's a newline, so
  1328.      * yy_get_previous_state() will have with '^' rules active
  1329.      */
  1330.  
  1331.     yytext = &yy_current_buffer->yy_ch_buf[1];
  1332.  
  1333.     return ( ret_val );
  1334. }
  1335.  
  1336.  
  1337. /* yy_get_previous_state - get the state just before the EOB char was reached
  1338.  *
  1339.  * synopsis
  1340.  *     yy_state_type yy_get_previous_state();
  1341.  */
  1342.  
  1343. static yy_state_type yy_get_previous_state()
  1344. {
  1345.     register yy_state_type yy_current_state;
  1346.     register YY_CHAR *yy_cp;
  1347.  
  1348.     register YY_CHAR *yy_bp = yytext;
  1349.  
  1350.     yy_current_state = yy_start;
  1351.     if ( yy_bp[-1] == '\n' )
  1352.     ++yy_current_state;
  1353.  
  1354.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  1355.     {
  1356.     register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  1357.     if ( yy_accept[yy_current_state] )
  1358.         {
  1359.         yy_last_accepting_state = yy_current_state;
  1360.         yy_last_accepting_cpos = yy_cp;
  1361.         }
  1362.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1363.         {
  1364.         yy_current_state = yy_def[yy_current_state];
  1365.         if ( yy_current_state >= 573 )
  1366.         yy_c = yy_meta[yy_c];
  1367.         }
  1368.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1369.     }
  1370.  
  1371.     return ( yy_current_state );
  1372. }
  1373.  
  1374.  
  1375. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1376.  *
  1377.  * synopsis
  1378.  *     next_state = yy_try_NUL_trans( current_state );
  1379.  */
  1380.  
  1381. static yy_state_type yy_try_NUL_trans( yy_current_state )
  1382. register yy_state_type yy_current_state;
  1383. {
  1384.     register int yy_is_jam;
  1385.     register YY_CHAR *yy_cp = yy_c_buf_p;
  1386.  
  1387.     register YY_CHAR yy_c = 1;
  1388.     if ( yy_accept[yy_current_state] )
  1389.     {
  1390.     yy_last_accepting_state = yy_current_state;
  1391.     yy_last_accepting_cpos = yy_cp;
  1392.     }
  1393.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1394.     {
  1395.     yy_current_state = yy_def[yy_current_state];
  1396.     if ( yy_current_state >= 573 )
  1397.         yy_c = yy_meta[yy_c];
  1398.     }
  1399.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1400.     yy_is_jam = (yy_current_state == 572);
  1401.  
  1402.     return ( yy_is_jam ? 0 : yy_current_state );
  1403. }
  1404.  
  1405.  
  1406. #if 0        /* not needed for NetHack */
  1407.  
  1408. static void yyunput( in_c, yy_bp )
  1409. int in_c;        /* YY_CHAR c; */
  1410. register YY_CHAR *yy_bp;
  1411. {
  1412.     register YY_CHAR *yy_cp = yy_c_buf_p;
  1413.     YY_CHAR c = (YY_CHAR)in_c;
  1414.  
  1415.     /* undo effects of setting up yytext */
  1416.     *yy_cp = yy_hold_char;
  1417.  
  1418.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1419.     { /* need to shift things up to make room */
  1420.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  1421.     register YY_CHAR *dest =
  1422.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  1423.     register YY_CHAR *source =
  1424.         &yy_current_buffer->yy_ch_buf[number_to_move];
  1425.  
  1426.     while ( source > yy_current_buffer->yy_ch_buf )
  1427.         *--dest = *--source;
  1428.  
  1429.     yy_cp += dest - source;
  1430.     yy_bp += dest - source;
  1431.     yy_n_chars = yy_current_buffer->yy_buf_size;
  1432.  
  1433.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  1434.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1435.     }
  1436.  
  1437.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  1438.     yy_cp[-2] = '\n';
  1439.  
  1440.     *--yy_cp = c;
  1441.  
  1442.     /* note: the formal parameter *must* be called "yy_bp" for this
  1443.      *       macro to now work correctly
  1444.      */
  1445.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  1446. }
  1447.  
  1448.  
  1449. static int yyinput()
  1450. {
  1451.     int c;
  1452.     YY_CHAR *yy_cp = yy_c_buf_p;
  1453.  
  1454.     *yy_cp = yy_hold_char;
  1455.  
  1456.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1457.     {
  1458.     /* yy_c_buf_p now points to the character we want to return.
  1459.      * If this occurs *before* the EOB characters, then it's a
  1460.      * valid NUL; if not, then we've hit the end of the buffer.
  1461.      */
  1462.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  1463.         /* this was really a NUL */
  1464.         *yy_c_buf_p = '\0';
  1465.  
  1466.     else
  1467.         { /* need more input */
  1468.         yytext = yy_c_buf_p;
  1469.         ++yy_c_buf_p;
  1470.  
  1471.         switch ( yy_get_next_buffer() )
  1472.         {
  1473.         case EOB_ACT_END_OF_FILE:
  1474.             {
  1475.             if ( yywrap() )
  1476.             {
  1477.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  1478.             return ( EOF );
  1479.             }
  1480.  
  1481.             YY_NEW_FILE;
  1482.  
  1483.             return ( yyinput() );
  1484.             }
  1485.             break;
  1486.  
  1487.         case EOB_ACT_CONTINUE_SCAN:
  1488.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  1489.             break;
  1490.  
  1491.         case EOB_ACT_LAST_MATCH:
  1492.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  1493.         }
  1494.         }
  1495.     }
  1496.  
  1497.     c = *yy_c_buf_p;
  1498.     yy_hold_char = *++yy_c_buf_p;
  1499.  
  1500.     return ( c );
  1501. }
  1502.  
  1503. #endif    /* 0 */
  1504.  
  1505.  
  1506. void yyrestart( input_file )
  1507. FILE *input_file;
  1508. {
  1509.     yy_init_buffer( yy_current_buffer, input_file );
  1510.     yy_load_buffer_state();
  1511. }
  1512.  
  1513.  
  1514. void yy_switch_to_buffer( new_buffer )
  1515. YY_BUFFER_STATE new_buffer;
  1516. {
  1517.     if ( yy_current_buffer == new_buffer )
  1518.     return;
  1519.  
  1520.     if ( yy_current_buffer )
  1521.     {
  1522.     /* flush out information for old buffer */
  1523.     *yy_c_buf_p = yy_hold_char;
  1524.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  1525.     yy_current_buffer->yy_n_chars = yy_n_chars;
  1526.     }
  1527.  
  1528.     yy_current_buffer = new_buffer;
  1529.     yy_load_buffer_state();
  1530.  
  1531.     /* we don't actually know whether we did this switch during
  1532.      * EOF (yywrap()) processing, but the only time this flag
  1533.      * is looked at is after yywrap() is called, so it's safe
  1534.      * to go ahead and always set it.
  1535.      */
  1536.     yy_did_buffer_switch_on_eof = 1;
  1537. }
  1538.  
  1539.  
  1540. void yy_load_buffer_state()
  1541. {
  1542.     yy_n_chars = yy_current_buffer->yy_n_chars;
  1543.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  1544.     yyin = yy_current_buffer->yy_input_file;
  1545.     yy_hold_char = *yy_c_buf_p;
  1546. }
  1547.  
  1548.  
  1549. YY_BUFFER_STATE yy_create_buffer( file, size )
  1550. FILE *file;
  1551. int size;
  1552. {
  1553.     YY_BUFFER_STATE b;
  1554.  
  1555.     b = (YY_BUFFER_STATE) alloc( sizeof( struct yy_buffer_state ) );
  1556.     b->yy_buf_size = size;
  1557.  
  1558.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1559.      * we need to put in 2 end-of-buffer characters.
  1560.      */
  1561.     b->yy_ch_buf = (YY_CHAR *) alloc( (unsigned) (b->yy_buf_size + 2) );
  1562.     yy_init_buffer( b, file );
  1563.  
  1564.     return ( b );
  1565. }
  1566.  
  1567.  
  1568. void yy_delete_buffer( b )
  1569. YY_BUFFER_STATE b;
  1570. {
  1571.     if ( b == yy_current_buffer )
  1572.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  1573.  
  1574.     free((genericptr_t)b->yy_ch_buf);
  1575.     free((genericptr_t)b);
  1576. }
  1577.  
  1578.  
  1579. void yy_init_buffer( b, file )
  1580. YY_BUFFER_STATE b;
  1581. FILE *file;
  1582. {
  1583.     b->yy_input_file = file;
  1584.  
  1585.     /* we put in the '\n' and start reading from [1] so that an
  1586.      * initial match-at-newline will be true.
  1587.      */
  1588.  
  1589.     b->yy_ch_buf[0] = '\n';
  1590.     b->yy_n_chars = 1;
  1591.  
  1592.     /* we always need two end-of-buffer characters.  The first causes
  1593.      * a transition to the end-of-buffer state.  The second causes
  1594.      * a jam in that state.
  1595.      */
  1596.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1597.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1598.  
  1599.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1600.  
  1601.     b->yy_eof_status = EOF_NOT_SEEN;
  1602. }
  1603.  
  1604. #ifdef    AMIGA
  1605. long *alloc(n)
  1606.     unsigned n;
  1607. {
  1608.     return ((long *)malloc (n));
  1609. }
  1610. #endif
  1611.  
  1612. /* routine to switch to another input file; needed for flex */
  1613. void init_yyin( input_f )
  1614. FILE *input_f;
  1615. {
  1616. #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
  1617.     if (yyin)
  1618.         yyrestart(input_f);
  1619.     else
  1620. #endif
  1621.         yyin = input_f;
  1622. }
  1623. /* analogous routine (for completeness) */
  1624. void init_yyout( output_f )
  1625. FILE *output_f;
  1626. {
  1627.     yyout = output_f;
  1628. }
  1629.  
  1630.